﻿@{
    Layout = null;
}

@Html.Partial("~/Views/Shared/HouTai_Header.cshtml")
<body >
    <!-- 网页导航菜单分布视图 -->
    @Html.Partial("~/Views/Shared/HouTai_DaoHang.cshtml")

    <div class="container">

        <div class="es-section course-manage-header clearfix">
            @*<a href="/course/157">*@
                @{
                    //这个地方不能用Session来处理
                    if ( Session["CoursesCImage"]==null || Session["CoursesCImage"].ToString() == "#")
                    {
                        <img class="picture" src="~/Content/img/user.png">
    @*<img src="~/Content/img/user.png" />
                    <p>图片</p>*@
                    }
                    else
                    {
                        <img class="picture" src="~/Content/images/@Session["CoursesCImage"]">
                        @*<img class="picture" src="@Session["CoursesCImage"]">*@
                    @*@Session["CoursesCImage"]*@
                    }
}
            @*</a>*@
            @*<h1 class="title">
                <a class="link-dark" href="/course/157">@{
                    
                }</a>
            </h1>*@
            <h1 class="title">
                @*<a class="link-dark" href="/course/157">*@
                @Session["CoursesCSutTitle"]
                @*</a>*@
            </h1>
            <div class="teachers">
                教师：
                @*<a href="/user/4">*@
                @Session["CoursesCreatePeople"]
                @*</a>*@
            </div>

            <div class="toolbar hidden-xs">

                <div class="btn-group">
                    <a class="btn btn-default btn-sm" href="/course/index">返回课程主页</a>
                </div>

                <div class="btn-group">
                    <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">预览 <span class="caret"></span></button>
                    <ul class="dropdown-menu pull-right">
                        <li><a href="/course/157?previewAs=member" target="_blank">作为 已购买用户</a></li>
                        <li><a href="/course/157?previewAs=guest" target="_blank">作为 未购买用户</a></li>
                    </ul>
                </div>


            </div>
        </div>

        <div class="row">

            <!-- 网页左侧菜单分布视图 -->
            @Html.Partial("~/Views/Shared/CouseCreateManage_Menu_Left.cshtml")


            <div class="col-md-10">

                <div class="panel panel-default panel-col">
                    <div class="panel-heading">
                        <div class="pull-right">
                            <a href="/Course/AddSelect" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-plus"></span> 选择题</a>
                            <a href="/Course/AddGapfilling" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-plus"></span> 填空题</a>
                            <a href="/Course/AddJudge" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-plus"></span> 判断题</a>
                            <a href="/Course/AddRespond" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-plus"></span>问答题</a>
                        </div>
                        题目管理
                    </div>

                    <div class="panel-body " id="quiz-table-container">
                        <form class="form-inline well well-sm" action="~/Course/TitleManage" method="get" novalidate="">
                            <div class="form-group">
                                <select class="form-control" name="QType" id="QType">
                                    <option value="">--按题型--</option>
                                    <option value="选择题">选择题</option>
                                    <option value="填空题">填空题</option>
                                    <option value="判断题">判断题</option>
                                    <option value="问答题">问答题</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <input type="text" id="keyword" name="QTitle" class="form-control" value="" placeholder="关键词">
                            </div>
                            <button class="btn btn-primary btn-sm" type="submit">搜索</button>
                        </form>
                        <table class="table table-striped table-hover" id="quiz-table">
                            <thead>
                                <tr>
                                    <th><input type="checkbox" autocomplete="off" data-role="batch-select"></th>
                                    <th width="50%">题干</th>
                                    <th>类型</th>
                                    <th>最后更新</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    int pageSize = ViewBag.pageSize;
                                    int pageIndex = ViewBag.pageIndex;
                                    IEnumerable<LeEdu.Entity.Questions> Slis = ViewBag.SelectList;
                                    //List<LeEdu.MODEL.Select> Slis = ViewBag.SelectList;
                                    //List<LeEdu.MODEL.Judge> Jlis = ViewBag.JudgeList;
                                    //List<LeEdu.MODEL.GapFilling> Glis = ViewBag.GapFillingList;
                                    //List<LeEdu.MODEL.Respond> Rlis = ViewBag.RespondList;
                                    var lis = (from a in Slis select new { id = a.Id, Name = a.Title, Ttype = a.Type, UpLoader = a.UserId, UpTime = a.CreateTime, courseId = a.CourseId, classhourId = a.ClassHourId, options = a.Options, answer = a.Answer, analysis = a.Analysis, level = a.Difficulty, score = a.Score, editTime=a.EditTime }).ToList();
                                           //.Union(from b in Jlis select new { id = b.JudgeId, Name = b.Stem, Ttype = b.Genre, UpLoader = b.UpLoader, UpTime = b.UpTime })
                                           //.Union(from c in Glis select new { id = c.GapFillingId, Name = c.Stem, Ttype = c.Genre, UpLoader = c.UpLoader, UpTime = c.UpTime })
                                           //.Union(from d in Rlis select new { id = d.RespondId, Name = d.Stem, Ttype = d.Genre, UpLoader = d.UpLoader, UpTime = d.UpTime }).ToList();
                                           
                                    lis = lis.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList();
    foreach (var item in lis)
    {
        <tr data-role="item">
            <td><input value="30" type="checkbox" autocomplete="off" data-role="batch-item"></td>
            <td>
                <a data-toggle="modal" data-target="#myModal" href="@item.id" onclick="Enid(this)">
                    <label>@item.Name</label>
                    <input hidden="hidden" name="id" id="id" value="@item.id" />

                </a>
                <div>
                    <small class="text-muted">从属于 本课程</small>
                </div>

            </td>
            <td>
                <input hidden="hidden" name="Ttype" id="Ttype1" value="@item.Ttype" />
                <span> @item.Ttype</span>
            </td>
            <td>
                <a class="link-dark " href="/user/4">@item.UpLoader</a>

                <br>
                <span class="text-muted text-sm">@item.UpTime</span>
            </td>
            <td>
                <div class="btn-group">
                    <a class="btn btn-default btn-sm" data-toggle="modal" data-target="#myModal" onclick="Enid(this)">预览</a>
                    <a href="#" type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" style="height:30px"><span class="caret"></span></a>
                    <ul class="dropdown-menu pull-right">
                        <li><a href="/Course/EditTitle/?id=@item.id&&Ttype=@item.Ttype"><span class="glyphicon glyphicon-edit"></span> 编辑</a></li>
                        <li><a href="/Course/DELTitle/?id=@item.id&&Ttype=@item.Ttype" data-name="题目" data-role="item-delete" id="Dels" onclick="return confirm('确认删除么？')"><span class="glyphicon glyphicon-remove-circle"></span> 删除</a></li>
                    </ul>
                </div>
            </td>
        </tr>
    }
}
                            </tbody>
                        </table>
                        <div>
                            <label class="checkbox-inline"><input type="checkbox" autocomplete="off" data-role="batch-select"> 全选</label>
                            <button class="btn btn-default btn-sm mlm" data-role="batch-delete" data-name="题目" data-url="/course/157/manage/question/deletes">删除</button>
                            <span class="pull-right text-muted">共 @ViewBag.Count 题</span>
                        </div>
                    </div>
                    <nav class=" text-center">
                        <ul id="pagination-demo" class="pagination-sm"></ul>
                        <script>
    var count;
    $('#pagination-demo').twbsPagination({
        totalPages:@(ViewBag.Count % pageSize == 0 ? ViewBag.Count / pageSize : ViewBag.Count / pageSize+1),
        first: "首页",
        prev: "上一页",
        next: "下一页",
        last: "尾页",
        href: '/Course/TitleManage/?id=@Session["Coursesid"]&&pageIndex={{pageNumber}}',
        hrefVariable: '{{pageNumber}}'
    });
</script>
                    </nav>

                </div>
            </div>

        </div>
    </div>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog  modal-lg">
            <div class="modal-content">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">题目预览</h4>
                <div class="modal-body">
                    <div class="testpaper-question testpaper-question-fill " data-watermark-url="/cloud/testpaper_watermark" id="question32">
                        <div class="testpaper-question-body">
                            <div class="testpaper-question-stem-wrap clearfix">
                                <div class="testpaper-question-seq-wrap">
                                    <div class="testpaper-question-seq"></div>
                                    <div class="testpaper-question-score">2.0</div>
                                </div>
                                <div class="testpaper-question-stem">
                                    <p><span class="question-stem-fill-blank" id="Names">item.Name</span></p><br>
                                </div>
                            </div>
                        </div>

                        <div class="testpaper-question-footer clearfix">
                            <div class="testpaper-question-fill-inputs">
                                <input class="form-control " type="text" data-type="fill" name="32" placeholder="填空(1)答案，请填在这里">
                            </div>

                            <div class="testpaper-question-actions pull-right">
                            </div>
                        </div>

                        <div class="testpaper-preview-answer clearfix mtl mbl">
                            <div class="testpaper-question-result">
                                <ul>
                                    <li>
                                        填空(1)： 正确答案 <strong class="text-success">@Session["Correct"]</strong>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="testpaper-question-analysis well">无解析</div>

                    </div>


                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-link" data-dismiss="modal" tabindex="6">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <script src="~/Scripts/jquery-1.8.2.min.js"></script>
   
</body>


